#include "bigimage.h"
#include "ui_bigimage.h"
#include "clickeventfilter.h"

BigImage::BigImage(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::BigImage)
{
    ui->setupUi(this);

    ClickEventFilter *clickFilter = new ClickEventFilter(this);
    ui->label->installEventFilter(clickFilter);

    connect(clickFilter, &ClickEventFilter::clicked, this, &BigImage::handleClick);
}

BigImage::~BigImage()
{
    delete ui;
}

void BigImage::handleClick()
{
    emit bigImgClicked();
    ui->label->clear();

}

void BigImage::showImg(QImage *img)
{
    ui->label->setPixmap(QPixmap::fromImage(*img));
}
